//
//  KKExitCell.m
//  DoMi
//
//  Created by 康凯 on 2016/12/29.
//  Copyright © 2016年 kk. All rights reserved.
//

#import "KKExitCell.h"
#import "KKLoginController.h"

@implementation KKExitCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)exit:(id)sender {
    UIAlertController *alert=[UIAlertController alertControllerWithTitle:@"提示" message:@"确定退出吗？" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
        [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
        KKLoginController *login=[[KKLoginController alloc] init];
        appWindow.rootViewController=login;
    }]];
    [[KKAppUtils getCurrentVisiableVC:self] presentViewController:alert animated:YES completion:nil];
}
@end
